forvalues i=2007(1)2016{
use applicant_race_name_1 applicant_ethnicity_name applicant_income applicant_sex_name rate_spread as_of_year action_taken if action_taken=="Loan originated" /*
*/using "$data/`i'.dta", clear
save "$data/`i'_demographics.dta", replace
}

use "$data/2007_demographics.dta", clear
forvalues i=2008(1)2016{
append using "$data/`i'_demographics.dta"
}


gen high_interest=0
replace high_interest=1 if rate_spread~=.

sort high_interest

drop if as_of<2010

drop high_interest

gen high_interest=0
replace high_interest=1 if rate_spread>5&rate_spread~=.



keep high_interest applicant_race applicant_ethnic applicant_income applicant_sex 



ttest applicant_income, by(high_interest)

gen african_american=0
replace african_american=1 if applicant_race_name_1=="Black or African American"

ttest african_american, by(high_interest)


gen hispanic=0
replace hispanic=1 if applicant_ethnicity=="Hispanic or Latino"
ttest hispanic, by(high_interest)

gen female=0
replace female=1 if applicant_sex=="Female"
ttest female, by(high_interest)



